package com.heima.utils.thread;

import com.heima.model.user.pojos.ApUser;

/**
 * @ClassName WmThreadLocalUtil
 * @Description TODO
 * @Author kiku
 * @Date 2024/8/20 20:49
 * @Version 1.0
 */
public class AppThreadLocalUtil {
    private final static ThreadLocal<ApUser> Ap_USER_THREAD_LOCAL=new ThreadLocal<>();

    //存入线程
    public static void setUser(ApUser apUser){
        Ap_USER_THREAD_LOCAL.set(apUser);
    }

    //从线程中获取
    public static ApUser getUser(){
        return Ap_USER_THREAD_LOCAL.get();
    }

    //清理
    public static void clear(){
        Ap_USER_THREAD_LOCAL.remove();
    }
}
